﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="news.aspx.cs" Inherits="AnaGiftedProject.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style2
        {
            color: #CC0000;
        }
        .style3
        {
            color: #666666;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
<div class="bodycontent ">
<br />
    <asp:DataList ID="DataList1" runat="server" DataKeyField="Id" 
        DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#CCCCCC" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" 
        GridLines="Horizontal" Font-Bold="False" Font-Italic="False" 
        Font-Overline="False" Font-Strikeout="False" Font-Underline="False">
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <ItemTemplate>
            <br />
            <span class="style2"><strong>العنوان:</strong></span>&nbsp;<asp:Label ID="SubjectLabel" runat="server" Text='<%# Eval("Subject") %>' />
            <br />
            <br />
            <span class="style2"><strong>الخبر:</strong></span>&nbsp;<asp:Label ID="BodyLabel" runat="server" Text='<%# Eval("Body") %>' />
            <br />
            <br />
            <span class="style3">الكاتب: </span>
            <asp:Label ID="UserIdLabel" runat="server" Text='<%# Eval("UserId") %>' 
                style="color: #666666" />
            <br />
            &nbsp;<asp:Label ID="DateAddLabel" runat="server" Text='<%# Eval("DateAdd") %>' 
                style="color: #666666;" />
            <br />
<br />
        </ItemTemplate>
        <SelectedItemStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlServerCS %>" 
        DeleteCommand="DELETE FROM [Events] WHERE [Id] = @Id" 
        InsertCommand="INSERT INTO [Events] ([Id], [Subject], [Body], [UserId], [DateAdd]) VALUES (@Id, @Subject, @Body, @UserId, @DateAdd)" 
        SelectCommand="SELECT * FROM [Events]" 
        UpdateCommand="UPDATE [Events] SET [Subject] = @Subject, [Body] = @Body, [UserId] = @UserId, [DateAdd] = @DateAdd WHERE [Id] = @Id">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Id" Type="Int32" />
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Body" Type="String" />
            <asp:Parameter Name="UserId" Type="Int32" />
            <asp:Parameter Name="DateAdd" Type="DateTime" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Body" Type="String" />
            <asp:Parameter Name="UserId" Type="Int32" />
            <asp:Parameter Name="DateAdd" Type="DateTime" />
            <asp:Parameter Name="Id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
   <br /><p><asp:Button ID="Button1" runat="server" Text="اضافة خبر" /></p>
</div>
<br/>


    </form>


</asp:Content>
